package com.ferry.taskflow.taskFlow.tx;

import com.ferry.taskflow.taskFlow.domain.TaskResult;

/**
 * Created by daiyong
 */
@Slf4j
public abstract class TxTask<RESULT> implements Task<RESULT> {

	/**
	 * 任务回滚
	 * @param taskResult
	 * @param result
	 */
	public void onRollback(TaskResult taskResult, RESULT result){
		log.error("TxTask execute rollback!, task:{}, result:{}", this.getClass().getName(), result);
	}

	@Override
	public void onSuccess(TaskResult taskResult, RESULT result) {
		log.info("TxTask execute success!, task:{}, result:{}", this.getClass().getName(), result);
	}

	@Override
	public void onFail(TaskResult taskResult, Throwable throwable) {
		log.error("TxTask execute fail! task:{}", this.getClass().getName(), throwable);
	}
}
